<template>
	<view class="second-content">
		<view class="second-box">
			<view class="second-top">
				<view class="top-image">
					<image src="../../static/index/keer.png" mode=""></image>
				</view>
				<view class="top-detail">
					<view class="second-name">科目二考试技巧</view>
					<view class="second-context">
						<view>￥128</view>
						<view>4课时</view>
					</view>
				</view>
			</view>
			<view class="second-video">
				<view class="video-title">
					<view>视频</view>
				</view>
				<view class="video-list">
					<view class="video-item" v-for="item in videoList" :key="item.id" @click="learnCourse(item.id)">
						<view>
							<image :src="item.image" mode=""></image>
						</view>
						<view>{{item.name}}</view>
					</view>
				</view>
			</view>
			<view class="sub-btn">
				<u-button shape="circle" :custom-style="customStyle" @click="gotoDetail">立即购买</u-button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				customStyle: {
					background: '#2AC092',
					color: '#fff'
				},
				videoList: [{
						id: 1,
						image: '../../static/index/keer.png',
						name: '科目二考试技巧'
					},
					{
						id: 2,
						image: '../../static/index/keer.png',
						name: '科目二考试技巧'
					},
					{
						id: 3,
						image: '../../static/index/keer.png',
						name: '科目二考试技巧'
					},
					{
						id: 4,
						image: '../../static/index/keer.png',
						name: '科目二考试技巧'
					}
				],

			}
		},
		methods: {
			gotoDetail(){
				uni.navigateTo({
					url:'/pagesA/confirmOrder/index'
				})
			},
			learnCourse(id) {
				uni.showModal({
					content: '请先购买课程，才可以播放',
					cancelText: '暂不购买',
					cancelColor: '#666666',
					confirmText: '购买课程',
					confirmColor: '#2AC092',
					success: function(res) {
						if (res.confirm) {
							console.log('用户点击确定');
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.second-top {
		.top-image {
			width: 100%;
			height: 380rpx;


			>image {
				width: 100%;
				height: 100%;
			}
		}

		.top-detail {
			background-color: #fff;
			padding: 20rpx;

			.second-name {
				color: #313233;
				font-size: 34rpx;
			}

			.second-context {
				margin-top: 20rpx;
				display: flex;
				justify-content: space-between;

				>view:nth-child(1) {
					color: #FF4D4D;
					font-size: 36rpx;
				}

				>view:nth-child(2) {
					color: #999999;
					font-size: 26rpx;
				}
			}
		}
	}

	.second-video {
		margin-top: 20rpx;

		.video-title {
			background-color: #fff;
			display: flex;
			justify-content: center;
			align-items: center;

			>view {
				height: 100%;
				border-bottom: 4rpx solid #2AC092;
				padding: 20rpx 10rpx;
			}
		}

		.video-list {
			display: flex;
			justify-content: space-between;
			flex-wrap: wrap;
			padding: 20rpx;

			.video-item {
				width: 49%;
				background-color: #fff;
				border-radius: 10rpx;
				margin-bottom: 20rpx;

				>view:nth-child(1) {
					height: 200rpx;
					width: 100%;

					>image {
						border-top-left-radius: 10rpx;
						border-top-right-radius: 10rpx;
						width: 100%;
						height: 100%;
					}
				}

				>view:nth-child(2) {
					padding: 20rpx;
					font-size: 28rpx;
				}
			}
		}
	}

	.sub-btn {
		position: fixed;
		bottom: 5rpx;
		width: 100%;
		padding: 20rpx;
		background-color: #fff;
	}
</style>